<div class="header">Neander simulator</div>
<table border='1'>
    <tr>
        <td class="title">
            <div>Compiler:</div>
        </td>
        <td class="title">
            <div>
                <span>Simulator:</span>
                <select id="base-selector-dropbox">
                    <option value="2">Bin</option>
                    <option value="8">Oct</option>
                    <option value="10" selected="selected">Dec</option>
                    <option value="16">Hex</option>
                </select>
                Clock frequency (1Hz~1kHz):
                <input class="short-input" type="text" value="10" id="clock-frequency" /> Hz
            </div>
        </td>
    </tr>
    <tr>
        <td valign="top">
            <table>
                <tr>
                    <td valign="top">
                        <div class="sub-title">Assembly editor</div>
                        <div>
                            <textarea id="assembly-code-box">
# definindo dados na memoria
.data 15 100
.data 14 -1

# inicio do programa
# carrega valor do end 15
lda 15

# adiciona valor do end 14
:add_point
add 14

# pula se zero
jz :sleep_point

# armazena no 11
sta 11

# pula incondicionalmente
jmp :add_point

# sleep
:sleep_point
hlt</textarea>
                        </div>
                        <div id="assembly-code-box-message"></div>
                        <button id="compile-button">Compile</button>
                        <span>(<a href="help.txt" target="_blank">ajuda</a>)</span>
                    </td>
                    <td valign="top">
                        <div class="sub-title">Compiled code</div>
                        <div>
                            <textarea id="compiled-code-box"></textarea>
                        </div>
                        <div id="compiled-code-box-message"></div>
                        <button id="load-compiled-button">Load to memory</button>
                    </td>
                </tr>
            </table>
        </td>
        <td valign="top">
            <table>
                <tr>
                    <td valign="top">
                        <div class="sub-title">CPU</div>
                          <div>
                            <table>
                                <tr>
                                    <td>AC: </td>
                                    <td><input class="medium-input" type="text" value="0" id="ac-box" /></td>
                                </tr>
                                <tr>
                                    <td>PC: </td>
                                    <td><input class="medium-input" type="text" value="0" id="pc-box" /></td>
                                </tr>
                                <tr>
                                    <td>Z: </td>
                                    <td><input class="medium-input" type="text" value="0" id="z-box" /></td>
                                </tr>
                                <tr>
                                    <td>N: </td>
                                    <td><input class="medium-input" type="text" value="0" id="n-box" /></td>
                                </tr>
                                <tr>
                                    <td>Memory access: </td>
                                    <td>
                                        R: <span id="memory-read-access" />0</span>
                                        W: <span id="memory-write-access" />0</span>
                                    </td>
                                </tr>
                            </table>
                            <button id="clock-tick-button">Clock tick</button>
                            <button id="reset-button">Reset</button>
                            <button id="sleep-button">Sleep</button>
                        </div>
                            <button id="power-button">Power on</button>
                    </td>
                    <td valign="top">
                        <div class="sub-title">Memory</div>
                        <div id="memory-grid-holder"></div>
                        <button id="erase-memory-button">Erase memory</button>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>


<link rel="stylesheet" type="text/css" href="style.css">
<script src="jquery.js" type="text/javascript"></script>
<script src="converter.js" type="text/javascript"></script>
<script src="instructions.js" type="text/javascript"></script>
<script src="decoder.js" type="text/javascript"></script>
<script src="memory.js" type="text/javascript"></script>
<script src="cpu.js" type="text/javascript"></script>
<script src="compiler.js" type="text/javascript"></script>
<script src="UI.js" type="text/javascript"></script>

<script type="text/javascript">
    
    if(jQuery.browser.msie) {
        alert("Opsss, you are using Internet Explorer... certainly the simulator will not work.");
    }
    
    var compiler = new Compiler();
    var converter = new Converter(10);
    
    var memory = new Memory(256);
    var decoder = new Decoder();
    var cpu = new Cpu();
    
    memory.erase();
    
    cpu.setMemory(memory);
    cpu.setDecoder(decoder);
    
    var ui = new UI(cpu);
    ui.init();

</script>
<div class="footer">Written by Dalmir da Silva &lt;dalmirdasilva@gmail.com&gt;</div>
